<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增学习资料标签')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-tag-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">标签名：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">热门标签显示：</label>
                <div class="col-sm-8">
                    <label class="toggle-switch switch-solid">
                        <input type="checkbox" id="showHot" >
                        <span></span>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "dict/tag"
        $("#form-tag-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {

                var data = $('#form-tag-add').serializeArray()
                var showHot = $("input[id='showHot']").is(':checked') == true ? 1 : 0;
            	data.push({"name": "showHot", "value": showHot});

                $.operate.save(prefix + "/add", data);
            }
        }
    </script>
</body>
</html>